package binarycrew.livewallpapers;

import android.app.Activity;
import android.os.Bundle;
import binarycrew.livewallpapers.wallpapers.Wallpapers;

public class MainActivity extends Activity {
    //private Wallpapers wallpapers = new Wallpapers();

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.main);


//        setContentView(R.layout.main_wallpaper_list);

//        ArrayList<WallpaperInfo> wallpapersInfo = wallpapers.getList();
//
//    	Bitmap icon = BitmapFactory.decodeResource(getApplicationContext().getResources(), R.drawable.background);
//
//    	FileOutputStream fos;
//		try {
//			fos = new FileOutputStream(new File(Preferences.getFilesDir(), Preferences.DEFAULT_IMAGE));
//			icon.compress(Bitmap.CompressFormat.JPEG, 90, fos);
//			fos.close();
//		} catch (FileNotFoundException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//
//        setListAdapter(
//            new WallpapersAdapter(this, R.layout.listview, wallpapersInfo)
//        );
    }

//    @Override
//    protected void onListItemClick(ListView l, View v, int position, long id){
//        WallpaperInfo o = (WallpaperInfo) l.getItemAtPosition(position);
//
//        Intent myIntent = new Intent(this, PreviewActivity.class);
//        myIntent.putExtra("wallpaper", o.getCode());
//        startActivity(myIntent);
//    }
//
//    private class WallpapersAdapter extends ArrayAdapter<WallpaperInfo> {
//        private ArrayList<WallpaperInfo> items;
//
//        public WallpapersAdapter(Context context, int textViewResourceId, ArrayList<WallpaperInfo> items) {
//            super(context, textViewResourceId, items);
//            this.items = items;
//        }
//
//        @Override
//        public View getView(int position, View convertView, ViewGroup parent) {
//            View v = convertView;
//            if (v == null) {
//                LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//                v = vi.inflate(R.layout.listview, null);
//            }
//            WallpaperInfo o = items.get(position);
//            if (o != null) {
//                TextView title = (TextView) v.findViewById(R.id.title);
//                TextView description = (TextView) v.findViewById(R.id.description);
//
//                if (title != null)
//                      title.setText(o.getName());
//
//                if(description != null)
//                      description.setText(o.getDescription());
//            }
//            return v;
//        }
//    }
}